package com.bbc.core.exception;

import com.bbc.core.constants.CoreConstants;

public final class ServiceException extends RuntimeException {
   private static final long serialVersionUID = 5095439538316185017L;
   private String code;
   private String message;
   private String detailMessage;

   public ServiceException() {
      this.code = CoreConstants.FAIL.toString();
   }

   public ServiceException(String message) {
      this.code = CoreConstants.FAIL.toString();
      this.message = message;
   }

   public ServiceException(String message, String code) {
      this.code = CoreConstants.FAIL.toString();
      this.message = message;
      this.code = code;
   }

   public ServiceException(Throwable throwable) {
      super(throwable.getMessage(), throwable);
      this.code = CoreConstants.FAIL.toString();
   }

   public ServiceException(String msg, Throwable throwable) {
      super(msg, throwable);
      this.code = CoreConstants.FAIL.toString();
   }

   public String getDetailMessage() {
      return this.detailMessage;
   }

   public String getMessage() {
      return this.message;
   }

   public String getCode() {
      return this.code;
   }

   public ServiceException setMessage(String message) {
      this.message = message;
      return this;
   }

   public ServiceException setDetailMessage(String detailMessage) {
      this.detailMessage = detailMessage;
      return this;
   }
}
